[NET] front: Do not allocate unnecessary page-sized main data area
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Fri, 11 Aug 2006 13:22:54 +0000 (14:22 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Fri, 11 Aug 2006 13:22:54 +0000 (14:22 +0100)
for receive skbuffs. The bulk data is stored in fragments.
Signed-off-by: Keir Fraser <keir@xensource.com>
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c

index 6bad0c4909703db36e9e94a80889b6e54da8d7bd..1556d2299cf6ab6eebd7fb6fe6fc0f1320146a0e 100644 (file)
@@ -609,9 +609,14 @@ static void network_alloc_rx_buffers(struct net_device *dev)
         */
        batch_target = np->rx_target - (req_prod - np->rx.rsp_cons);
        for (i = skb_queue_len(&np->rx_batch); i < batch_target; i++) {
-               /* Allocate an skb and a page. */
-               skb = __dev_alloc_skb(RX_COPY_THRESHOLD,
-                                     GFP_ATOMIC | __GFP_NOWARN);
+               /*
+                * Allocate an skb and a page. Do not use __dev_alloc_skb as
+                * that will allocate page-sized buffers which is not
+                * necessary here.
+                * 16 bytes added as necessary headroom for netif_receive_skb.
+                */
+               skb = alloc_skb(SKB_DATA_ALIGN(RX_COPY_THRESHOLD + 16),
+                               GFP_ATOMIC | __GFP_NOWARN);
                if (unlikely(!skb))
                        goto no_skb;